/*
 * Copyright (c) 2015 qunar. All Rights Reserved.
 */
package com.guoyu.project.model.enums;

import java.util.Map;

import com.google.common.collect.Maps;

/**
 * @author: libo Date: 15-6-7 Time: 下午5:43
 */
public enum PolicyType implements ArticleMinorType {
    /**
     * 国家级
     */
    NATIONAL(1, "国家及部委政策"),
    /**
     * 省市级
     */
    PROVINCIAL(2, "行业及省市政策"),
    /**
     * 学校级
     */
    SCHOOL(3, "学校政策"),
    /**
     * 其他
     */
    OTHER(4, "其他文件"),;

    private int code;
    private String desc;

    PolicyType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return this.name();
    }

    static Map<Integer, PolicyType> codeMapper = Maps.newHashMap();
    static {
        for (PolicyType newsType : values()) {
            codeMapper.put(newsType.getCode(), newsType);
        }
    }

    public static PolicyType codeOf(int code) {
        return codeMapper.get(code);
    }
}
